const http = require("http");
const fs = require("fs");
const path = require("path");
const url = require("url");

http.createServer((req, res) => {
    let urlObj = url.parse(req.url);
    console.log(urlObj.pathname)
    switch (urlObj.pathname) {
        case "/":
            pageName = "02login.html";
            break;
        case "/pathname/":
            res.end(urlObj.query);
            return;
    }
    // console.log(req.headers);
    // console.log(req.method);
    // console.log(req.url)
    let filePath = path.join(__dirname, "testUrl.html");
    let fileContent = fs.readFileSync(filePath);
    res.end(fileContent);
}).listen(8080);
